home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Medal Software 3
/
Gold Medal Software - Volume 3 (Gold Medal) (1994).iso
/
graphvew
/
mpegw32.arj
/
DISK1.ARJ
/
32SINST.MST
< prev
next >
Wrap
Text File
|
1993-05-04
|
9KB
|
339 lines
'**************************************************************************
'* MSSetup Toolkit Sample 1
'**************************************************************************
'' $DEFINE DEBUG ''Define for script development/debugging
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST OPTIONS = 800
CONST BADPATH = 6400
CONST HELPWELCOME = 1000
CONST VERPATH = 1100
CONST EXITFAILNOTWIN31 = 1200
CONST EXITFAILNOTENH = 1300
CONST EXITFAILNOTINTEL = 1350
CONST MPEGPLAYINST = 1400
CONST MPEGPLAYINSTNOWIN32S = 1450
CONST MPEGPLAYPATH = 1500
CONST HELPMPEGPLAY = 1600
''Bitmap ID
CONST LOGO = 1
GLOBAL DESTSYS$ ''Windows\System directory.
GLOBAL DEST32S$ ''Windows\System\Win32s directory
GLOBAL DESTMPEG$ ''MPEGPLAY directory
DECLARE SUB Install
DECLARE SUB UpdateSystemIni
DECLARE SUB RebootSystem
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE FUNCTION MakeSystemIni LIB "INIUPD.DLL" (arg1$, arg2$) AS INTEGER
DECLARE FUNCTION RestartWindows LIB "INIUPD.DLL" (arg1$) AS INTEGER
DECLARE FUNCTION OnWindowsNT LIB "INIUPD.DLL" AS INTEGER
INIT:
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
SetBitmap CUIDLL$, LOGO
SetTitle "MPEGPLAY and Microsoft Win32s Setup Program"
szInf$ = GetSymbolValue("STF_SRCINFPATH")
IF szInf$ = "" THEN
szInf$ = GetSymbolValue("STF_CWDDIR") + "32sinst.inf"
END IF
ReadInfFile szInf$
DESTSYS$ = GetWindowsSysDir()
DEST32S$ = DESTSYS + "WIN32S\"
'$IFDEF DEBUG
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
WinDrive$ = MID$(GetWindowsDir, 1, 1)
IF IsDriveValid(WinDrive$) = 0 THEN
i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
'$ENDIF ''DEBUG
CHECK:
WIN32ENABLED% = 0
IF GetWindowsMajorVersion < 3 THEN
ExitCode% = EXITFAILNOTWIN31
GOTO QUIT
END IF
IF GetWindowsMajorVersion = 3 AND GetWindowsMinorVersion < 1 THEN
ExitCode% = EXITFAILNOTWIN31
GOTO QUIT
END IF
IF GetWindowsMajorVersion >= 4 THEN
ExitCode% = EXITSUCCESS
WIN32ENABLED% = 1
GOTO MPEGPLAY
END IF
IF GetWindowsMode < 2 THEN
IF OnWindowsNT() THEN
ExitCode% = EXITFAILNOTINTEL '' Running on Windows NT (on RISC)
ELSE
ExitCode% = EXITFAILNOTENH '' Standard Mode Windows
END IF
GOTO QUIT
END IF
IF OnWindowsNT() THEN
ExitCode% = EXITSUCCESS
WIN32ENABLED% = 1
GOTO MPEGPLAY
END IF
ExitCode% = EXITSUCCESS
szOldVer$ = GetVersionOfFile( DESTSYS$ + "WIN32S16.DLL" )
szNewVer$ = GetVersionOfFile( GetSymbolValue("STF_SRCDIR") + "WIN32S16.DLL" )
IF "1" <> GetIniKeyString( DESTSYS$ + "WIN32S.INI", "Win32s", "Setup") THEN
GOTO WELCOME
END IF
IF szOldVer$ = "" THEN
GOTO WELCOME
END IF
IF szNewVer$ > szOldVer$ THEN
GOTO WELCOME
END IF
WIN32ENABLED% = 1
GOTO MPEGPLAY
WELCOME:
sz$ = UIStartDlg(CUIDLL$, WELCOME, "FInfoDlgProc", HELPWELCOME, HELPPROC$)
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOSUB ASKQUIT
GOTO WELCOME
END IF
GETWIN32SPATH:
SetSymbolValue "EditTextIn", DESTSYS$
SetSymbolValue "EditFocus", "END"
GETPATHL1:
sz$ = UIStartDlg(CUIDLL$, VERPATH, "FDispDlgProc", HELPWELCOME, HELPPROC$)
IF sz$ = "CONTINUE" THEN
IF IsDirWritable(DESTSYS$) = 0 THEN
GOSUB BADPATH
GOTO GETPATHL1
END IF
UIPop 1
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETPATHL1
ELSEIF sz$ = "BACK" THEN
UIPop 1
GOTO WELCOME
ELSE
GOSUB ASKQUIT
GOTO GETPATHL1
END IF
COPYFILES:
CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "0", cmoOverwrite
CreateDir DEST32S$, cmoNone
Install
UpdateSystemIni
CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Setup", "1", cmoOverwrite
CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "Win32s", "Version", szNewVer$, cmoOverwrite
MPEGPLAY:
IF WIN32ENABLED% = 1 THEN
sz$ = UIStartDlg(CUIDLL$, MPEGPLAYINSTNOWIN32S, "FInfoDlgProc",0, "")
ELSE
sz$ = UIStartDlg(CUIDLL$, MPEGPLAYINST, "FInfoDlgProc",0, "")
END IF
IF sz$ = "CONTINUE" THEN
UIPop 1
ELSE
GOTO QUIT
END IF
GETMPEGPATH:
DESTMPEG$ = MID$(DESTSYS$,1,3) + "WIN32APP\MPEGPLAY\"
SetSymbolValue "EditTextIn", DESTMPEG$
SetSymbolValue "EditFocus", "END"
GETMPEGPATHL1:
sz$ = UIStartDlg(CUIDLL$, MPEGPLAYPATH, "FEditDlgProc", HELPMPEGPLAY, HELPPROC$)
IF sz$ = "CONTINUE" THEN
DESTMPEG$ = GetSymbolValue("EditTextOut")
IF MID$(DESTMPEG$, LEN(DESTMPEG$), 1) <> "\" THEN
DESTMPEG$ = DESTMPEG$ + "\"
END IF
''Validate new path.
IF IsDirWritable(DESTMPEG$) = 0 THEN
GOSUB BADPATH
GOTO GETMPEGPATHL1
END IF
UIPop 1
GOTO COPYMPEGPLAY
ELSEIF sz$ = "REACTIVATE" THEN
GOTO GETMPEGPATHL1
ELSEIF sz$ = "EXIT" THEN
UIPop 1
GOTO QUIT
END IF
COPYMPEGPLAY:
ClearCopyList
CreateDir DESTMPEG$, cmoNone
SrcDir$ = GetSymbolValue("STF_SRCDIR")
AddSectionFilesToCopyList "Win32appMPEGPLAY", SrcDir$, DESTMPEG$
CopyFilesInCopyList
CreateProgmanGroup "Win32 Applications", "", cmoNone
ShowProgmanGroup "Win32 Applications", 1, cmoNone
CreateProgmanItem "Win32 Applications", "MPEGPLAY", DESTMPEG$ + "MPEGPLAY.EXE", "", cmoOverwrite
IF DoesFileExist( DESTSYS$ + "WIN32S.INI", femExists ) THEN
CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "MPEGPLAY", "Setup", "1", cmoOverwrite
CreateIniKeyValue DESTSYS$ + "WIN32S.INI", "MPEGPLAY", "Version", szNewVer$, cmoOverwrite
END IF
i% = DoMsgBox("MPEGPLAY was successfully installed.", "MPEGPLAY Setup", MB_OK+MB_TASKMODAL)
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = ExitCode%
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
IF WIN32ENABLED% = 1 THEN
UIPop 1
END
END IF
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
RebootSystem
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
'**
'** Purpose:
'** Builds the copy list and performs all installation operations.
'** Arguments:
'** none.
'** Returns:
'** none.
'*************************************************************************
SUB Install STATIC
SrcDir$ = GetSymbolValue("STF_SRCDIR")
AddSectionFilesToCopyList "WindowsSystem", SrcDir$, DESTSYS$
AddSectionFilesToCopyList "WindowsSystemWin32s", SrcDir$, DESTSYS$ + "WIN32S\"
t% = RestartWindows( GetWindowsSysDir() + "OLECLI.DLL" )
SetRestartDir GetWindowsDir()
CopyFilesInCopyList
END SUB
SUB UpdateSystemIni STATIC
VxDPath$ = DEST32S$ + "W32S.386"
SystemIniPath$ = GetWindowsDir()
t% = MakeSystemIni(SystemIniPath$, VxdPath$)
END SUB
SUB RebootSystem STATIC
i% = RestartListEmpty()
i% = ExitExecRestart()
END SUB
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION